package com.d0324;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegTest {
    public static void main(String[] args) {
        /*String regex = "((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        Pattern pattern = Pattern.compile(regex);
        String phonenumber = "1394586558";
        Matcher matcher = pattern.matcher(phonenumber);
        if (matcher.matches()){
            System.out.println("正确");
        }else {
            System.out.println("失败");
        }*/

        /*String phoneNumber = "1394586558";
        String regex = "((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        boolean result = Pattern.matches(regex,phoneNumber);
        if (result){
            System.out.println("正确");
        }else {
            System.out.println("错误");
        }*/

        String phoneNum = "13958965698";
        String regex = "((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        boolean result = phoneNum.matches(regex);
        if (result){
            System.out.println("正确");
        }else {
            System.out.println("不对");
        }
    }
}
